#! /usr/bin/env python3
import Augmentor
import fire


def dataAugmentor(source_dir, output_dir='output', sample_num=None):
    p = Augmentor.Pipeline(source_dir, output_dir)

    p.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)
    p.zoom(probability=0.5, min_factor=0.8, max_factor=1.2)
    p.random_erasing(probability=0.5, rectangle_area=0.15)

    sample_num = sample_num or len(p.augmentor_images) * 2
    p.sample(sample_num)
    print('\tsample end!')

if __name__ == '__main__':
    fire.Fire(dataAugmentor)
